/**
 * Copyright (c) 2015-2030 by Beijing Yanlight Co., Ltd.
 * All rights reserved.
 */
package com.yanlight.app.controller;

import javax.servlet.http.HttpServletResponse;

import com.yanlight.util.DevTokenUtil;
import com.yanlight.util.WebUtil;

/**
 * 
 * @author haolw
 * @time 2017/09/01
 */
public class BaseController {
	private final String REDIRECT_URL_PREFIX = "redirect:";
	private final String FORWARD_URL_PREFIX = "forward:";

	protected String redirect(String path) {
		return REDIRECT_URL_PREFIX.concat(path);
	}

	protected String forward(String path) {
		return FORWARD_URL_PREFIX.concat(path);
	}

	protected void renderText(HttpServletResponse response,String content) {
		WebUtil.renderText(response, content);
	}
	
	protected Integer getDevBindCompanyId() {
		return DevTokenUtil.get().getCompanyId();
	}
	
	protected Integer getDevId() {
		return DevTokenUtil.get().getId();
	}

}
